<!DOCTYPE html>
<html>
<head>

    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">

</head>

<body>

系统载入中，请稍等...

<?php
//验证登陆信息
session_start();

include_once("../config.php");
include_once '../connection.php';

$account = $_POST['account'];
$name = $_POST['name'];
$password = $_POST['password'];
$repassword = $_POST['repassword'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$code = $_POST['code'];


$regcode = strrev(substr($phone+1234,7));
if($code!=$regcode){
    echo "<script language='javascript'>alert('验证码错误！');location='register.php';</script>";
    exit;
}

if (!preg_match("/^[0-9a-zA-Z]{6,12}$/", $account)) {echo "<script language='javascript'>alert('非法用户名！');location='register.php';</script>"; exit;}
if ("" == $name) {echo "<script language='javascript'>alert('公司名称不能为空！');location='register.php';</script>";}
if (strlen($password) < 6 && strlen($password) > 12 ) {echo "<script language='javascript'>alert('请输入正确的密码长度！');location='register.php';</script>";}
if($password != $repassword){echo "<script language='javascript'>alert('密码不匹配！');location='register.php';</script>";}
if(!filter_var($email, FILTER_VALIDATE_EMAIL)){echo "<script language='javascript'>alert('邮箱格式不正确！');location='register.php';</script>";}




$table = $table_Prefix."backstage_application";
$query = mysql_query("SELECT COUNT(1) FROM $table where name ='$name'");
$sum = mysql_result($query, 0);
mysql_close($con);

if ($sum > 0) {
    echo "<script language='javascript'>alert('该账号已存在！');location='register.php';</script>";
} else{
    $sql = "INSERT INTO $table (name,password,email ,phone,status,account,created_date ) value ('$name','".md5($password)."','$email','$phone','待审核','$account',now())";
    $query = mysql_query($sql) or die ("error:".mysql_error());
    mysql_close($con);

    echo '<script type="text/javascript">alert("注册成功，待通过审核，点击确认返回继续操作.");document.location.href = "index.php";</script>';
}


?>
</body>